import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
//Author:synktc


public class logics {

	
	public static void main(String[] args) {
		 BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	     Scanner z = new Scanner(System.in);    
		 
	     String opsi = null;
	     String a,b;
	     
	        System.out.println("-=Program operasi logika=-");
	        System.out.println("1. Konjungsi");
	        System.out.println("2. Disjungsi");
	        System.out.println("3. Implikasi");
	        System.out.println("4. Negasi");
	        
	        
	        System.out.print("Masukan pilihan: ");
	        try{
	            opsi=input.readLine();
	        }catch(IOException e){
	            System.out.println("Input error");
	        }
	        System.out.println(opsi);
	        int intopsi=Integer.parseInt(opsi);
	        switch(intopsi){
	            //konjungsi
	        	case 1: {
	            	System.out.println("Operasi Konjungsi");
	            	System.out.println("Nilai A: ");
	            	a = z.next();
	            	a = a.toUpperCase();
	            	System.out.println("Nilai B: ");
	            	b = z.next();
	            	b = b.toUpperCase();
	            	if (a.equals("T") && b.equals("T")){
	            		System.out.println("-----------------------");
	            		System.out.println(a+"^"+b+"=T");
	            	}	            	
	            	else {
	            		System.out.println("-----------------------");
	            		System.out.println(a+"^"+b+"=F");
	            	}
	            break;
	            } //disjungsi
	            case 2: {
	            	System.out.println("Operasi Disjungsi");
	               	System.out.println("Nilai A: ");
	            	a = z.next();
	            	a = a.toUpperCase();
	            	System.out.println("Nilai B: ");
	            	b = z.next();
	            	b = b.toUpperCase();
	            	if (a.equals("F") && b.equals("F")){
	            		System.out.println("-----------------------");
	            		System.out.println(a+"v"+b+"=F");
	            	} else {
	            		System.out.println("-----------------------");
	            		System.out.println(a+"v"+b+"=T");
	            	}
               	break;
	            } //implikasi
	            case 3: {
	            	System.out.println("Operasi Implikasi");
	               	System.out.println("Nilai A: ");
	            	a = z.next();
	            	a = a.toUpperCase();
	            	System.out.println("Nilai B: ");
	            	b = z.next();
	            	b = b.toUpperCase();
	            	if (a.equals("T") && b.equals("F")){
	            		System.out.println("-----------------------");
	            		System.out.println(a+"->"+b+"=F");
	            	} else {
	            		System.out.println("-----------------------");
	            		System.out.println(a+"->"+b+"=T");
	            	}
               	break;
	            }//negasi
	            case 4: {
	            	System.out.println("Operasi Negasi");
	               	System.out.println("Nilai A: ");
	            	a = z.next();
	            	a = a.toUpperCase();
	            	if (a.equals("F")){
	            		System.out.println("-----------------------");
	            		System.out.println("!"+a+"=T");
	            	} else {
	            		System.out.println("-----------------------");
	            		System.out.println("!"+a+"=F");
	            	}
               	break;
	            }
	            
	            default: System.out.println("Diluar Jangkauan");
	            break;
	        }
	    }

	}